/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * 字符串常量统一管理
 * 避免硬编码字符串散布在代码中
 */
export class StringConstants {
  
  // ========== 基础类型字符串 ==========
  static readonly TYPE_BOOLEAN = 'boolean'
  static readonly TYPE_NUMBER = 'number'
  static readonly TYPE_STRING = 'string'
  static readonly TYPE_BIGINT = 'bigint'
  static readonly TYPE_NULL = 'null'
  static readonly TYPE_UNDEFINED = 'undefined'
  static readonly TYPE_ARRAY = 'array'
  static readonly TYPE_SET = 'set'
  static readonly TYPE_MAP = 'map'
  static readonly TYPE_UNION = 'union'
  static readonly TYPE_ENUM = 'enum'

  // ========== 序列化器名称 ==========
  // 基础类型序列化器（单例INSTANCE模式）
  static readonly BOOLEAN_SERIALIZER = 'BooleanSerializer'
  static readonly NUMBER_SERIALIZER = 'NumberSerializer'
  static readonly STRING_SERIALIZER = 'StringSerializer'
  static readonly BIGINT_SERIALIZER = 'BigintSerializer'
  
  // 特殊原始类型序列化器（单例INSTANCE模式）
  static readonly NULL_SERIALIZER = 'NullSerializer'
  static readonly UNDEFINED_SERIALIZER = 'UndefinedSerializer'
  
  // 集合类型序列化器（泛型构造器模式）
  static readonly ARRAY_SERIALIZER = 'ArraySerializer'
  static readonly COLLECTIONS_ARRAY_SERIALIZER = 'CollectionsArraySerializer'
  static readonly MAP_SERIALIZER = 'MapSerializer'
  static readonly COLLECTIONS_MAP_SERIALIZER = 'CollectionsMapSerializer'
  static readonly SET_SERIALIZER = 'SetSerializer'
  static readonly COLLECTIONS_SET_SERIALIZER = 'CollectionsSetSerializer'
  static readonly RECORD_SERIALIZER = 'RecordSerializer'

  // 高级类型序列化器（特殊构造器模式）
  static readonly UNION_TYPE_SERIALIZER = 'UnionTypeSerializer'
  static readonly OPTIONAL_SERIALIZER = 'OptionalSerializer'
  static readonly NULLABLE_SERIALIZER = 'NullableSerializer'
  static readonly ENUM_SERIALIZER = 'EnumSerializer'
  
  // 通用序列化器
  static readonly SERIALIZER = 'Serializer'
  static readonly SERIALIZER_FACTORY = 'SerializerFactory'

  // ========== 编码/解码方法名 ==========
  // 基础类型专用编码方法
  static readonly ENCODE_BOOLEAN_ELEMENT = 'encodeBooleanElement'
  static readonly ENCODE_NUMBER_ELEMENT = 'encodeNumberElement'
  static readonly ENCODE_STRING_ELEMENT = 'encodeStringElement'
  static readonly ENCODE_BIGINT_ELEMENT = 'encodeBigintElement'
  
  // 特殊原始类型专用编码方法
  static readonly ENCODE_NULL_ELEMENT = 'encodeNullElement'
  static readonly ENCODE_UNDEFINED_ELEMENT = 'encodeUndefinedElement'
  
  // 通用编码方法
  static readonly ENCODE_SERIALIZABLE_ELEMENT = 'encodeSerializableElement'

  // 基础类型专用解码方法
  static readonly DECODE_BOOLEAN = 'decodeBoolean'
  static readonly DECODE_NUMBER = 'decodeNumber'
  static readonly DECODE_STRING = 'decodeString'
  static readonly DECODE_BIGINT = 'decodeBigint'
  
  // 特殊原始类型专用解码方法
  static readonly DECODE_NULL = 'decodeNull'
  static readonly DECODE_UNDEFINED = 'decodeUndefined'
  
  // 通用解码方法
  static readonly DESERIALIZABLE = 'deserialize'

  // ========== 导入模块相关 ==========
  static readonly IMPORT_BUILD_CLASS_SERIAL_DESCRIPTOR = 'buildClassSerialDescriptor'
  static readonly IMPORT_DECODER = 'Decoder'
  static readonly IMPORT_ENCODER = 'Encoder'
  static readonly IMPORT_SERIAL_DESCRIPTOR = 'SerialDescriptor'
  static readonly IMPORT_SERIALIZER = 'Serializer'

  static readonly IMPORT_TJSON = 'TJSON'
  static readonly IMPORT_IT_SERIALIZABLE = 'ITSerializable'
  static readonly IMPORT_LANG = 'lang'

  // ========== 类型推断相关 ==========
  static readonly BOOLEAN_WRAPPER = 'Boolean'
  static readonly NUMBER_WRAPPER = 'Number'
  static readonly STRING_WRAPPER = 'String'

  static readonly ARRAY_SUFFIX = '[]'
  static readonly ARRAY_PREFIX = 'array<'

  // ========== 默认值相关 ==========
  static readonly DEFAULT_VALUE_FALSE = 'false'
  static readonly DEFAULT_VALUE_ZERO = '0'
  static readonly DEFAULT_VALUE_EMPTY_STRING = "''"
  static readonly DEFAULT_VALUE_ZERO_BIGINT = '0n'
  static readonly DEFAULT_VALUE_UNDEFINED = 'undefined'

  // ========== 模板字符串片段 ==========
  static readonly TEMPLATE_ELEMENT_NAME = 'element'
  static readonly TEMPLATE_SENDABLE_ERROR_PREFIX = 'Sendable support not enabled for'
  
  // ========== 文件操作相关 ==========
  static readonly FILE_OPERATION_EMPTY_STRING = ''
  static readonly REGEX_IMPORT_STATEMENT = /import\s+({[^}]+}|\w+)\s+from\s+'([^']+)'/
  static readonly REGEX_SRC_MAIN_ETS = /\/src\/main\/ets\/(.*)\.ets$/
  
  // ========== 分隔符和连接符 ==========
  static readonly SEPARATOR_COMMA = ','
  static readonly SEPARATOR_COMMA_NEWLINE = ',\n'
  static readonly SEPARATOR_NEWLINE = '\n'
  static readonly SEPARATOR_COMMA_SPACE = ', '
  static readonly JOIN_ELEMENT_PREFIX = ',\n  '
  
  // ========== 正则表达式字符串 ==========
  static readonly CURLY_BRACE_START = '{'
  static readonly PATH_RELATIVE_PREFIX = './'
  static readonly INSTANCE_SUFFIX = '.INSTANCE'
  static readonly SERIALIZER_SUFFIX = 'Serializer'
  
  // ========== 日志前缀 ==========
  static readonly LOG_PREFIX_T_SERIALIZATION = '[TSerialization]'
  static readonly LOG_MODULE_PREFIX_TEMPLATE = '[${module}]'
  
  // ========== 插件标识 ==========
  static readonly PLUGIN_ID = 'turboTransJsonPlugin'
  
  // ========== 模块标识符 ==========
  static readonly JSON_MODULE_SPECIFIER = '@hadss/hmserialization-json'
  static readonly ARKTS_MODULE_SPECIFIER = '@kit.ArkTS'
}